<?php include "../public/header.php";?>
<?php include "../public/header_show.php";?>
<body id="xiangqingPage">
<div id="xiangqingBox">
    <div class="page-title">
        <div class="page-title-con">
            <span class="pageshowtitle">详情</span>
            <div class="page-title-opt-list">
                <?php include "../public_flow/flow_show_optbut.php";?>
                <button class="layui-btn layui-btn-sm btn-light marginr5 opt">
                    操作<i class="layui-icon layui-icon-down layui-font-12"></i>
                </button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
    <div class="main-container">
        <div class="tongbox tongbox5">
            <div class="tuo">
                <div class="tit">项目名称</div>
                <div class="con" id="tong_enginname"></div>
            </div>
            <div class="tuo">
                <div class="tit">合同金额(元)</div>
                <div class="con" id="tong_money"></div>
            </div>
            <div class="tuo">
                <div class="tit">累计审定产值(元)</div>
                <div class="con colorlan" id="tong_lei_chan"></div>
            </div>
            <div class="tuo">
                <div class="tit">累计开票(元)</div>
                <div class="con colorlan" id="tong_lei_piaokai"></div>
            </div>
            <div class="tuo">
                <div class="tit">累计回款(元)</div>
                <div class="con colorlan" id="tong_lei_huikuan"></div>
            </div>
        </div>

        <div><?php include "../public_flow/flow_show_info.php";?></div>

        <div class="table-box tablenes">
            <div class="title">基本信息</div>
            <table class="layui-table">
                <tbody>

                <tr><td class="tt">项目名称</td><td id="enginname" class="colorlan tv" ></td><td class="tt">项目属性</td><td id="business_name" class="tv"></td></tr>
                <tr><td class="tt">所属单位</td><td id="chanid_name" class="tv"></td><td class="tt">项目负责人</td><td id="man_xiang_name" class="tv"></td></tr>
                <tr id="businessDiv" class="layui-hide"><td class="tt">联营单位</td><td id="lian_unit" class="tv"></td><td class="tt">内包协议</td><td id="neiid_name" class="colorlan tv"></td></tr>

                <tr><td class="tt">合同名称</td><td id="name" class="tv"></td><td class="tt">合同编号</td><td id="number" class="tv"></td></tr>
                <tr><td class="tt">合同类型</td><td id="shihetype" class="tv"></td><td class="tt">合同年份</td><td id="year" class="tv"></td></tr>
                <tr><td class="tt">(发包方)甲方</td><td id="faer" class="tv"></td><td class="tt">承包方(乙方)</td><td id="chenger_name" class="tv"></td></tr>
                <tr><td class="tt">合同金额(元)</td><td id="money" class="tv"></td><td class="tt">税率(%)</td><td id="rate" class="tv"></td></tr>
                <tr><td class="tt">合同开工日期</td><td id="startdt" class="tv"></td><td class="tt">合同竣工日期</td><td id="enddt" class="tv"></td></tr>
                <tr><td class="tt">工期</td><td id="duration" class="tv"></td><td class="tt">质量验收等级</td><td id="zhilevel" class="tv"></td></tr>
                <tr><td class="tt">合同状态</td><td id="state_name" colspan="3"></td></tr>
                <tr><td class="tt">甲方联系人</td><td id="fauser" class="tv"></td><td class="tt">我方签订人</td><td id="myer" class="tv"></td></tr>
                <tr><td class="tt">甲方联系方式</td><td id="fatel" class="tv"></td><td class="tt">签订日期</td><td id="qiandt" class="tv"></td></tr>

                <tr><td class="tt">质保金比例(%)</td><td id="zhirate" class="tv"></td><td class="tt">质保金金额(元)</td><td id="zhifee" class="tv"></td></tr>
                <tr><td class="tt">质保期(天)</td><td id="zhinum" class="tv"></td><td class="tt">质保金到期日期</td><td id="zhidt" class="tv"></td></tr>



                <tr><td class="tt">工程承包范围</td><td class="tv" id="scope" colspan="3"></td></tr>
                <tr><td class="tt">结算方式</td><td class="tv" id="settle" colspan="3"></td></tr>
                <tr><td class="tt">支付条件</td><td class="tv" id="zhitiao" colspan="3"></td></tr>
                <tr><td class="tt">主要条款</td><td class="tv" id="clause" colspan="3"></td></tr>
                <tr><td class="tt">违约责任</td><td class="tv" id="viola" colspan="3"></td></tr>
                <tr><td class="tt">备案情况</td><td class="tv" id="record" colspan="3"></td></tr>
                <tr><td class="tt">备注</td><td class="tv" id="explain" colspan="3"></td></tr>
                </tbody>
            </table>
        </div>

        <div><?php include "../public/upinfo_show.php";?></div>

        <div><?php include "../public_flow/flow_show_flowrelas.php";?></div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo">补充合同</script>
            <div class="tableShow">
                <table id="datalist" lay-filter="datalist"></table>
            </div>
        </div>

        <div class="table-box tablenes">
            <script type="text/html" id="toolbarDemo_gong">工程量清单</script>
            <div class="tableShow">
                <table id="datalist_gong" lay-filter="datalist_gong"></table>
            </div>
        </div>

        <div><?php include '../public_flow/flow_show_shenlog.php'?></div>
        <div><?php include '../public_flow/flow_show_talk.php'?></div>
        <div><?php include '../public/opt_browse.php'?></div>
    </div>
</div>
<script>
    var param_isdan = getQueryVariable('isdan') || 0;
    if(param_isdan > 0){
        $("#page-close").remove();
    }
    var param_id = getQueryVariable('id') || 0;

    layui.use(['form', 'layer', "laytp",'element','dropdown','laypage','table','soulTable'], function() {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable,element = layui.element;

        facade.ajax({url: ask_contract_shi_show, data:{id: param_id}}).done(function(res){
            if (res.code === 2000) {
                var data = res.data.data;
                var engininfo = res.data.engininfo;

                $("#enginname").text(engininfo.name).click(function () {
                    openPage('../engin/show.php?id='+engininfo.id);
                });
                $("#business_name").text(engininfo.business_name);
                $("#chanid_name").text(engininfo.chanid_name);
                $("#man_xiang_name").text(engininfo.man_xiang_name);
                if(engininfo.business == 2){
                    $("#businessDiv").removeClass('layui-hide');
                    $("#lian_unit").text(engininfo.lian_unit);
                    $("#neiid_name").text(data.neiid_name).click(function () {
                        openPage('../contract_nei/show.php?id='+data.neiid);
                    });
                }


                $("#tong_enginname").text(engininfo.name);
                $("#tong_money").text(parseFormatNum(data.shihemoney));
                $("#tong_lei_chan").text(parseFormatNum(data.lei_chan)).click(function () {
                    openPage('../engin_chan/tong.php?enginname='+encodeURI(engininfo.name)+'&status=1', '80%', '80%');
                });
                $("#tong_lei_piaokai").text(parseFormatNum(data.lei_piaokai)).click(function () {
                    openPage('../piao_kai/tong.php?enginname='+encodeURI(engininfo.name)+'&status=1', '80%', '80%');
                });
                $("#tong_lei_huikuan").text(parseFormatNum(data.lei_huikuan)).click(function () {
                    openPage('../income_engin/tong.php?enginname='+encodeURI(engininfo.name)+'&status=1', '80%', '80%');
                });


                $("#name").text(data.name);
                $("#number").text(data.number);
                $("#shihetype").text(data.shihetype);
                $("#year").text(data.year);
                $("#faer").text(data.faer);
                $("#chenger_name").text(data.chenger_name);
                $("#money").text(data.money);
                $("#rate").text(data.rate);
                $("#startdt").text(data.startdt);
                $("#enddt").text(data.enddt);
                $("#duration").text(data.duration);
                $("#zhilevel").text(data.zhilevel);
                $("#state_name").text(data.state_name);
                $("#fauser").text(data.fauser);
                $("#myer").text(data.myer);
                $("#fatel").text(data.fatel);
                $("#qiandt").text(data.qiandt);
                $("#zhirate").text(data.zhirate);
                $("#zhifee").text(data.zhifee);
                $("#zhinum").text(data.zhinum);
                $("#zhidt").text(data.zhidt);
                $("#scope").text(data.scope);
                $("#settle").text(data.settle);
                $("#zhitiao").text(data.zhitiao);
                $("#clause").text(data.clause);
                $("#viola").text(data.viola);
                $("#record").text(data.record);
                $("#explain").text(data.explain);

                var mytableList = table.render({
                    elem: "#datalist",data:res.data.list, toolbar: '#toolbarDemo', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field:'',title:'流程状态',templet: function(d){
                                if(d.billid > 0){
                                    if(d.status == 0){
                                        return '<span class="list_billid colorlan" onclick="openPage(\'../contract_bu/show.php?id='+d.id+'\');">流程(审批中)</span>'
                                    }else if(d.status == 1){
                                        return '<span class="list_billid colorlan" onclick="openPage(\'../contract_bu/show.php?id='+d.id+'\');">流程(审批通过)</span>'
                                    }else{
                                        return '';
                                    }
                                }else{
                                    return '<td>手动</td>';
                                }
                            }}
                        ,{field:'',title:'补充合同名称',templet: function(d){
                                return '<span class="colorlan" onclick="show_contractbu('+d.id+')">'+d.name+'</span>';
                            }}
                        ,{field: 'number', title: '合同编号'}
                        ,{field: 'money', title: '合同金额(元)'}
                        ,{field: 'qianer', title: '签订人'}
                        ,{field: 'qiandt', title: '签订日期'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });

                var mytableList22 = table.render({
                    elem: "#datalist_gong",data:res.data.gong, toolbar: '#toolbarDemo_gong', page: false
                    ,limit:TabInitShow.limit,soulSort: TabInitShow.soulSort,method: TabInitShow.method, overflow: TabInitShow.overflow
                    ,defaultToolbar: TabInitShow.defaultToolbar,filter: TabInitShow.filter ,text: TabInitShow.text
                    ,request: TabInitShow.request,response: TabInitShow.response,contextmenu:get_table_contextmenu(soulTable)
                    , cols: [[
                        {type:'numbers',title:'序号',fixed:'left'}
                        ,{field: 'num', title: '清单编号'}
                        ,{field: 'name', title: '分部名称'}
                        ,{field: 'xiang', title: '分项名称'}
                        ,{field: 'unit', title: '单位'}
                        ,{field: 'bulk', title: '工程量'}
                        ,{field: 'price', title: '综合单价(元)'}
                        ,{field: 'heprice', title: '合价(元)'}
                        ,{field: 'explain', title: '备注'}
                    ]]
                    , done: function (res) {
                        soulTable.render(this);
                    }
                });


                public_flow_show_display(res.data.billinfo);
                public_upload_show_file('upload_files', res.data.files);
                render_from();
            }
        });

        public_get_readsandlog('contract_shi', param_id);
    });

    function show_contractbu(id) {
        openPage('../contract_bu/show.php?id='+id);
    }







</script>
</body>
</html>




